﻿<UserControl x:Class="Project.ViewDeclarations"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
             mc:Ignorable="d" 
             d:DesignHeight="550" d:DesignWidth="900">
    <UserControl.Resources>
        <Style TargetType="{x:Type Expander}">
            <Style.Triggers>
                <EventTrigger RoutedEvent="Expander.Expanded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetProperty="Height" To="95" Duration="0:0:0.3"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
                <EventTrigger RoutedEvent="Expander.Collapsed">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <DoubleAnimation Storyboard.TargetProperty="Height" To="25" Duration="0:0:0.3"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Style.Triggers>
        </Style>
        <DataTemplate x:Key="DeclarationDetailsTemplate">
            <Border BorderThickness="0,0,0,0" BorderBrush="#69810E">
                <StackPanel Height="Auto">
                    <TextBlock Width="Auto" TextWrapping="Wrap" Margin="10,0,0,0" Text="{Binding Path=RegistrationDate, StringFormat='Fecha de Registro: {0}'}" ToolTip="Fecha en que se registró la declaración"/>
                    <TextBlock Margin="10,0,0,0" Text="{Binding Path=ActorType, StringFormat='Tipo Declarante: {0}'}"  ToolTip="Tipo de declarante de la declaración" />
                    <TextBlock Margin="10,0,0,0" Text="{Binding FullName}"  ToolTip="Nombre completo del declarante" />
                    <TextBlock  Margin="10,0,0,0" Text="{Binding Path=DeclarantCI, StringFormat='CI: {0}'}"  ToolTip="CI del declarante" />
                </StackPanel>
            </Border>
        </DataTemplate>
        <DataTemplate x:Key="DeclarationQuestionsTemplate">
            <Border BorderThickness="0,0,0,0" BorderBrush="#69810E">
                <StackPanel Height="Auto">
                    <Expander Height="25" Width="540" Header="Preguntas y Respuestas">
                        <ListBox Height="60" ItemsSource="{Binding QuestionsAndAnswer}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Width="Auto" Margin="3,0,0,0" Text="{Binding Path=NumberOfQuestion, StringFormat='\{0}.-'}" />
                                        <TextBlock Width="Auto" Margin="3,0,0,0" Text="{Binding Question}" ToolTip="Pregunta"/>
                                        <TextBlock Margin="10,0,0,0" Text="{Binding Path=Answer, StringFormat='-> R: {0}' }"  ToolTip="Respuesta" />
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Expander>
                </StackPanel>
            </Border>
        </DataTemplate>
    </UserControl.Resources>
    <Grid Name="Content" >
        <Grid Height="36" Margin="11,11,56,0" Name="gridTitle"  VerticalAlignment="Top">
            <Border BorderBrush="#5C5C5C" BorderThickness="0,0,0,2">
                <TextBlock FontSize="24" FontWeight="Normal" Text="Ver Declaraciones" Width="711" HorizontalAlignment="Left" ></TextBlock>
            </Border>
        </Grid>
        <ScrollViewer Margin="0,85,0,0" ScrollViewer.VerticalScrollBarVisibility="Auto">
            <StackPanel Margin="0,0,0,25">
                    <Grid Name="expanderGrid" Height="40" VerticalAlignment="Center" >
                        <Label Content="Buscar por declaraciones de:" Height="18" HorizontalAlignment="Left" Margin="29,12,0,10" Name="label7" VerticalAlignment="Center" />
                    <ComboBox Height="23" HorizontalAlignment="Left" Margin="185,0,0,0" Name="cbByWhat" VerticalAlignment="Center" Width="126" SelectionChanged="cbByWhat_SelectionChanged">
                        <ComboBoxItem Content="Todos" IsSelected="True" />
                        <ComboBoxItem Content="Victima"/>
                        <ComboBoxItem Content="Denunciante"/>
                        <ComboBoxItem Content="Informante"/>
                        <ComboBoxItem Content="Agresor"/>
                        <ComboBoxItem Content="Testigo"/>
                    </ComboBox>
                </Grid>
                <Grid Margin="0,10,0,0">
                    <ListView Width="830" Height="430" Name="listViewDeclarations" ItemsSource="{Binding}" ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}" Margin="32,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Left">
                        <ListView.ContextMenu>
                            <ContextMenu Name="ContMenu">
                                <MenuItem Name="ModDeclarationOp" Header="Modificar Declaración" Click="ModifyDeclaration_OnClick"/>
                                <MenuItem Name="ViewDeclarationOp" Header="Ver Declaración" Click="MenuItem_OnClick"/>
                            </ContextMenu>
                        </ListView.ContextMenu>
                        <ListView.View>
                            <GridView>
                                <GridViewColumn CellTemplate="{StaticResource DeclarationDetailsTemplate}" Width="Auto" Header="Detalles"/>
                                <GridViewColumn CellTemplate="{StaticResource DeclarationQuestionsTemplate}" Width="550" Header="Preguntas y Respuestas" />
                            </GridView>
                        </ListView.View>
                    </ListView>
                </Grid>
            </StackPanel>
        </ScrollViewer>
        <Label Content="Numero de Caso:" FontSize="18" FontWeight="Light" Height="28" HorizontalAlignment="Left" Margin="12,53,0,0" Name="label28" VerticalAlignment="Top" />
        <Label Content="" FontSize="26" FontWeight="Light" Height="30" HorizontalAlignment="Left" Margin="150,47,0,0" Name="lblCaseNumber" VerticalAlignment="Top" />
    </Grid>
</UserControl>
